-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\mdnieman\Desktop\PSRM replication\PSRM_PRR.log
  log type:  text
 opened on:  12 Dec 2017, 14:41:30

. /*******************************/
> /*  Mark David Nieman & Cameron G Thies */
> /*  9/15/2017        */
> /*  Property Rights Regimes, Tech Innovation, and FDI  */
> /*  Data Analysis  */
> /*  Stata 14.1/MP    */
> /*******************************/
> clear;

. clear matrix;

. program drop _all;

. set emptycells drop ;

. set seed 200;

. tempfile temp temp_efw;

. /* Load data */
> use psrm_prr;

.                 /* Center variables */
>         foreach var of varlist efw2legalrights xconst GDPgrowth ln_GDP2005US ln_resource 
>                                                         ruralpopul  ln_pop ln_battle ln_durable TradePctGDP 
>                                                         lnbit_count ln_World_FDI  lji kaopen ln_GDP_pc2005USD 
>                                                         {;
  2.                 quietly sum `var';
  3.                 gen c`var' = `var'-r(mean);
  4.         };
(6,299 missing values generated)
(2,480 missing values generated)
(2,793 missing values generated)
(1,689 missing values generated)
(167 missing values generated)
(258 missing values generated)
(217 missing values generated)
(2,220 missing values generated)
(2,999 missing values generated)
(3,280 missing values generated)
(167 missing values generated)
(1,428 missing values generated)
(2,216 missing values generated)
(1,689 missing values generated)

.         gen cPRdemoc = cefw2legalrights*cxconst;
(6,459 missing values generated)

.         gen clji_democ = clji*cxconst;
(2,691 missing values generated)

. save `temp', replace;
(note: file C:\Users\mdnieman\AppData\Local\Temp\ST_06000001.tmp not found)
file C:\Users\mdnieman\AppData\Local\Temp\ST_06000001.tmp saved

. /* Figure 1 */
> /* Graph PR and Democ */
> use `temp', clear;

.         /* identify sample */
>         xtmixed ln_FDI_net_inflows efw2legalrights polity2  || _all: R.ccode || _all: R.year, mle;

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log likelihood =  38.609007  
Iteration 1:   log likelihood =  38.609007  

Computing standard errors:

Mixed-effects ML regression                     Number of obs     =      1,654
Group variable: _all                            Number of groups  =          1

                                                Obs per group:
                                                              min =      1,654
                                                              avg =    1,654.0
                                                              max =      1,654

                                                Wald chi2(2)      =      14.77
Log likelihood =  38.609007                     Prob > chi2       =     0.0006

------------------------------------------------------------------------------------
ln_FDI_net_inflows |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------+----------------------------------------------------------------
   efw2legalrights |   .0151229   .0064319     2.35   0.019     .0025165    .0277293
           polity2 |  -.0054702   .0016964    -3.22   0.001    -.0087951   -.0021454
             _cons |   3.416321    .051015    66.97   0.000     3.316333    3.516308
------------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity               |
                 sd(R.ccode) |   .2619467   .0185494      .2280007    .3009467
-----------------------------+------------------------------------------------
_all: Identity               |
                  sd(R.year) |   .1194849   .0230009      .0819325    .1742487
-----------------------------+------------------------------------------------
                sd(Residual) |   .2067541    .003799      .1994406    .2143358
------------------------------------------------------------------------------
LR test vs. linear model: chi2(2) = 959.24                Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

.                 /* make graph */
> twoway kdensity efw2legalrights if polity2>6 & e(sample)==1, scheme(s1mono) lpattern(solid) 
>         || kdensity efw2legalrights if polity2<7 & e(sample)==1, lpattern(dash) 
>                 xtitle("Property Right Protections") 
>                 ytitle("Kernel Density") ylabel("")
>                 legend(lab(1 "Democracy") lab(2 "Non-democracy")) 
>                 note("Note: Democracy is coded as polity2>6 using Polity IV (Marshall and Jaggers 2014). Property Rights" 
>                         "measured as the Legal System and Structure of Property Rights (Gwartney, Hall and Lawson 2011).")
>                 title("Figure 1. Rule of Law and Democracy.");

.                         graph save Figure_1, replace;
(note: file Figure_1.gph not found)
(file Figure_1.gph saved)

.         /* Figure 2 */          
> /* Graph World FDI */
> use `temp', clear;

.         replace World_FDI = World_FDI/1000;
(7,981 real changes made)

. collapse  World_FDI, by(year);

.         twoway line World_FDI year, ytitle("FDI") xtitle("Year")
>                 title("Figure 2. Aggregated World FDI Over Time.")
>                 scheme(s1mono) lcolor(black) lwidth(medthick) 
>                 note("Note: Foreign Direct Investment figures are in billions of US dollars.");

.                         graph save Figure_2, replace;
(note: file Figure_2.gph not found)
(file Figure_2.gph saved)

.                 /* Analysis */
> 
>         /* Table 2 Model 1*/
>         use `temp', clear;

.         xtmixed ln_FDI_net_inflows cPRdemoc cefw2legalrights cxconst cln_GDP2005US cln_GDP_pc2005USD cGDPgrowth cTradePctGDP ckaopen cln_resource cln_battle
>                 || _all: R.ccode || _all: R.year, mle;

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log likelihood =  89.236859  
Iteration 1:   log likelihood =  89.236859  

Computing standard errors:

Mixed-effects ML regression                     Number of obs     =      1,533
Group variable: _all                            Number of groups  =          1

                                                Obs per group:
                                                              min =      1,533
                                                              avg =    1,533.0
                                                              max =      1,533

                                                Wald chi2(10)     =     237.46
Log likelihood =  89.236859                     Prob > chi2       =     0.0000

------------------------------------------------------------------------------------
ln_FDI_net_inflows |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------+----------------------------------------------------------------
          cPRdemoc |   .0078401   .0025011     3.13   0.002     .0029379    .0127423
  cefw2legalrights |  -.0156687   .0072677    -2.16   0.031    -.0299131   -.0014243
           cxconst |  -.0117467   .0058135    -2.02   0.043     -.023141   -.0003525
     cln_GDP2005US |   .1083071    .011929     9.08   0.000     .0849268    .1316874
 cln_GDP_pc2005USD |   .0077685   .0174825     0.44   0.657    -.0264966    .0420336
        cGDPgrowth |   .0000147   .0014364     0.01   0.992    -.0028005      .00283
      cTradePctGDP |   .0011514   .0003091     3.72   0.000     .0005455    .0017572
           ckaopen |   .0071643    .006641     1.08   0.281    -.0058518    .0201803
      cln_resource |  -.0412929   .0102275    -4.04   0.000    -.0613384   -.0212474
        cln_battle |  -.0038367   .0023561    -1.63   0.103    -.0084545    .0007811
             _cons |   3.382861   .0290417   116.48   0.000      3.32594    3.439782
------------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity               |
                 sd(R.ccode) |   .1717215   .0125897      .1487371    .1982577
-----------------------------+------------------------------------------------
_all: Identity               |
                  sd(R.year) |   .0766357   .0168192      .0498446    .1178267
-----------------------------+------------------------------------------------
                sd(Residual) |   .2057964   .0039192      .1982566     .213623
------------------------------------------------------------------------------
LR test vs. linear model: chi2(2) = 558.08                Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

.                 matrix B = e(b);

.                 matrix C = e(V);

.                 matrix k = e(k);

.                 matrix L = e(ll);

.                 svmat k;

.                 svmat L;

.                 gen AIC_fm = 2*k1 - 2*L1;
(8,147 missing values generated)

.                 sum AIC_fm;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      AIC_fm |          1   -150.4737           .  -150.4737  -150.4737

.                         /* Correlation between democracy and property rights, reported in independent variables subsection */
>                         corr cefw2legalrights cxconst if e(sample)==1;
(obs=1,533)

             | cefw2l~s  cxconst
-------------+------------------
cefw2legal~s |   1.0000
     cxconst |   0.4427   1.0000


.                                                                         /* Figure 3 */
>                         /* Generate marginal effect of changing Democ from their Min to their Max */
>                         collapse (mean) cxconst;

.                         expand 7;
(6 observations created)

.                         replace cxconst = _n-4;
(7 real changes made)

.                                                 /* Take 1000 draws */
>                         expand 1000;
(6,993 observations created)

.                         drawnorm bxz bx bz b01 b02 b03 b04 b05 b06 b07 b00 b10 b20 resid , means(B) cov(C);

.                                                         /* Generate the marginal effects variable and change over the full range of Property Rights */
>                         gen gamma = bx + cxconst*(bxz);

.                         collapse (mean) gamma (sd) sd_gamma = gamma, by(cxconst);

.                         /* Generate 90% confidence intervals */
>                         gen gamma_lo = gamma - 1.645*sd_gamma ;

.                         gen gamma_hi = gamma + 1.645*sd_gamma;

.                         replace cxconst = cxconst + 4;
(7 real changes made)

.                                 /* Create a kdensity plot */
>                         mkmat cxconst-gamma_hi , matrix(collapsed) ;

.                         use `temp', clear;

.                         keep cxconst;

.                         replace cxconst = cxconst + 4;
(5,668 real changes made)

.                         rename cxconst kdensity_xconst;

.                         svmat collapsed, names(col);

.                                 /* Graph marginal effects */            
>                                 twoway lowess gamma cxconst, scheme(s1mono) lcolor(black) lwidth(medthick)
>                                 || lowess gamma_lo cxconst, lcolor(gray) lwidth(medium) lpattern(dash)
>                                 || lowess gamma_hi cxconst, lcolor(gray) lwidth(medium) lpattern(dash)
>                                 || kdensity kdensity_xconst, n(7) yaxis(2) lpattern(shortdash_dot) lcolor(gs8) lwidth(thin) 
>                                 yline(0, lpattern(dot) lcolor(gs8))  xtitle("Level of Democracy")
>                                 legend(off)
>                                 ytitle("Kernal Density Estimate of Democracy", axis(2))
>                                 ytitle("Marginal Effect of Property Rights on FDI")
>                                 title("Figure 3. Marginal Effects of Property Rights on FDI.")
>                                 note("Note: Dashed lines give 90% confidence interval. Light dashed-dot line displays the Kernal density" 
>                                         "estimate. Displayed value is from model 1 of Table 2.");

.                                         graph save Figure_3, replace;
(note: file Figure_3.gph not found)
(file Figure_3.gph saved)

.                 /* Table 2 Model 2*/
>         /* Time-varying model */
>         /* Interactions of c.cPRdemoc#year c.cefw2legalrights#year not displayed in published table (visualized in Figure 4 instead) */
>                 use `temp', clear;

.                 xtmixed ln_FDI_net_inflows c.cPRdemoc#year c.cefw2legalrights#year cxconst cln_GDP2005US cln_GDP_pc2005USD cGDPgrowth cTradePctGDP ckaopen cln_resource cln_b
> attle
>                 || _all: R.ccode || _all: R.year , mle ;

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log likelihood =  244.65969  
Iteration 1:   log likelihood =  244.65969  

Computing standard errors:

Mixed-effects ML regression                     Number of obs     =      1,533
Group variable: _all                            Number of groups  =          1

                                                Obs per group:
                                                              min =      1,533
                                                              avg =    1,533.0
                                                              max =      1,533

                                                Wald chi2(40)     =     603.41
Log likelihood =  244.65969                     Prob > chi2       =     0.0000

-----------------------------------------------------------------------------------------
     ln_FDI_net_inflows |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
        year#c.cPRdemoc |
                  1970  |    -.00596   .0079137    -0.75   0.451    -.0214705    .0095505
                  1975  |  -.0047651   .0071238    -0.67   0.504    -.0187275    .0091974
                  1980  |  -.0064373   .0058612    -1.10   0.272     -.017925    .0050504
                  1985  |  -.0046838   .0054076    -0.87   0.386    -.0152825    .0059149
                  1990  |   .0006986   .0053916     0.13   0.897    -.0098687    .0112659
                  1995  |  -.0031706   .0072956    -0.43   0.664    -.0174697    .0111284
                  2000  |   .0278618   .0065571     4.25   0.000     .0150101    .0407135
                  2001  |   .0065816   .0058935     1.12   0.264    -.0049694    .0181327
                  2002  |   .0049273   .0058024     0.85   0.396    -.0064453    .0162999
                  2003  |  -.0009783   .0056226    -0.17   0.862    -.0119984    .0100419
                  2004  |  -.0096513   .0058913    -1.64   0.101     -.021198    .0018954
                  2005  |   .0080963     .00618     1.31   0.190    -.0040163    .0202089
                  2006  |   .0152756   .0065273     2.34   0.019     .0024823     .028069
                  2007  |    .026935   .0059759     4.51   0.000     .0152224    .0386475
                  2008  |   .0170284   .0065941     2.58   0.010     .0041041    .0299526
                  2009  |   .0002673   .0078496     0.03   0.973    -.0151175    .0156522
                        |
year#c.cefw2legalrights |
                  1970  |  -.0594996   .0202437    -2.94   0.003    -.0991764   -.0198227
                  1975  |  -.0724193   .0204674    -3.54   0.000    -.1125346    -.032304
                  1980  |  -.0535233   .0138252    -3.87   0.000    -.0806202   -.0264264
                  1985  |  -.0642933   .0129303    -4.97   0.000    -.0896361   -.0389505
                  1990  |  -.0344272   .0127054    -2.71   0.007    -.0593293   -.0095252
                  1995  |  -.0208919     .01777    -1.18   0.240    -.0557205    .0139367
                  2000  |   .0384035   .0157236     2.44   0.015     .0075857    .0692213
                  2001  |   .0152233    .013801     1.10   0.270    -.0118261    .0422727
                  2002  |   .0036788   .0134107     0.27   0.784    -.0226058    .0299633
                  2003  |  -.0033094   .0130958    -0.25   0.800    -.0289766    .0223578
                  2004  |   -.013809   .0139717    -0.99   0.323    -.0411929     .013575
                  2005  |   .0199735   .0141184     1.41   0.157     -.007698    .0476449
                  2006  |   .0442398    .015256     2.90   0.004     .0143385    .0741411
                  2007  |   .0671923   .0140788     4.77   0.000     .0395984    .0947862
                  2008  |    .033079   .0154023     2.15   0.032     .0028911    .0632669
                  2009  |   .0134966   .0178199     0.76   0.449    -.0214297    .0484229
                        |
                cxconst |  -.0039922   .0054703    -0.73   0.466    -.0147138    .0067293
          cln_GDP2005US |   .1140311   .0119323     9.56   0.000     .0906442    .1374181
      cln_GDP_pc2005USD |  -.0236816   .0173997    -1.36   0.174    -.0577844    .0104211
             cGDPgrowth |  -7.73e-08   .0013284    -0.00   1.000    -.0026037    .0026035
           cTradePctGDP |   .0011341   .0002943     3.85   0.000     .0005573    .0017109
                ckaopen |   .0058684   .0060984     0.96   0.336    -.0060842     .017821
           cln_resource |  -.0334038   .0098289    -3.40   0.001     -.052668   -.0141396
             cln_battle |  -.0009803   .0021908    -0.45   0.655    -.0052742    .0033137
                  _cons |   3.372291   .0260324   129.54   0.000     3.321269    3.423314
-----------------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity               |
                 sd(R.ccode) |   .1772001   .0123843      .1545164    .2032138
-----------------------------+------------------------------------------------
_all: Identity               |
                  sd(R.year) |   .0573257   .0155386      .0336995    .0975157
-----------------------------+------------------------------------------------
                sd(Residual) |   .1843297   .0035138      .1775698     .191347
------------------------------------------------------------------------------
LR test vs. linear model: chi2(2) = 685.88                Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

.                 gen time= 1 if e(sample)==1;
(6,615 missing values generated)

.                 egen id = group(ccode) if e(sample)==1;
(6615 missing values generated)

.                         save `temp', replace;
file C:\Users\mdnieman\AppData\Local\Temp\ST_06000001.tmp saved

.                 matrix k_t = e(k);

.                 matrix L_t = e(ll);

.                 svmat k_t;

.                 svmat L_t;

.                 gen AIC_t = 2*k_t1 - 2*L_t1;
(8,147 missing values generated)

.                 sum AIC_t;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       AIC_t |          1   -401.3194           .  -401.3194  -401.3194

.                         predict REccode_yr REyear_yr, reffects level(_all);
(2,941 missing values generated)
(4,981 missing values generated)

.                 /* Figure 4 */          
>                 /* Generate marginal effects of PR*/
>                 gen MEslope_1970 = (_b[1970b.year#cPRdemoc])*cxconst + _b[1970b.year#cefw2legalrights] + REyear_yr if year==1970;
(8,027 missing values generated)

.                 gen MEslope_t=0;

.                 #delimit;
delimiter now ;
.                         forvalues year=1975(5)2000  {;
  2.                                                 replace MEslope_t = (_b[`year'.year#cPRdemoc])*cxconst + _b[`year'.year#cefw2legalrights] + REyear_yr if year==`year';
  3.                         };
(201 real changes made, 71 to missing)
(201 real changes made, 74 to missing)
(201 real changes made, 72 to missing)
(201 real changes made, 72 to missing)
(196 real changes made, 49 to missing)
(197 real changes made, 50 to missing)

.                                                 forvalues year=2001/2009  {;
  2.                                                 replace MEslope_t = (_b[`year'.year#cPRdemoc])*cxconst + _b[`year'.year#cefw2legalrights] + REyear_yr if year==`year';
  3.                         };
(197 real changes made, 50 to missing)
(197 real changes made, 48 to missing)
(197 real changes made, 49 to missing)
(197 real changes made, 49 to missing)
(197 real changes made, 47 to missing)
(197 real changes made, 43 to missing)
(197 real changes made, 44 to missing)
(195 real changes made, 41 to missing)
(195 real changes made, 41 to missing)

.                         replace MEslope_t=MEslope_1970 if year==1970;
(201 real changes made, 80 to missing)

.                                                 /* Plot slope over time */
>                                 collapse MEslope_t, by(xconst year time);

.                                 #delimit;
delimiter now ;
.                                         twoway connected MEslope_t year if year<2010 & xconst==1 & time==1, connect(L) scheme(s1mono) lpattern(solid) msymbol(circle) mcolor(
> gs14) lcolor(gs14)
>                                         || connected MEslope_t year if year<2010 & xconst==2 & time==1, connect(L) lpattern(solid) msymbol(circle) mcolor(gs12) lcolor(gs12)
>                                         || connected MEslope_t year if year<2010 & xconst==3 & time==1, connect(L) lpattern(solid) msymbol(circle) mcolor(gs10) lcolor(gs10)
>                                         || connected MEslope_t year if year<2010 & xconst==4 & time==1, connect(L) lpattern(solid) msymbol(circle) mcolor(gs8) lcolor(gs8)
>                                         || connected MEslope_t year if year<2010 & xconst==5 & time==1, connect(L) lpattern(solid) msymbol(circle) mcolor(gs6) lcolor(gs6)
>                                         || connected MEslope_t year if year<2010 & xconst==6 & time==1, connect(L) lpattern(solid) msymbol(circle) mcolor(gs4) lcolor(gs4)
>                                         || connected MEslope_t year if year<2010 & xconst==7 & time==1, connect(L) lpattern(solid) msymbol(circle) mcolor(gs2) lcolor(gs2) 
>                                                 xtitle("Year") legend(off) yline(0, lpattern(dot) lcolor(gs8))
>                                                 ytitle("Marginal Effect of Property Rights on FDI")
>                                                 title("Figure 4. Time-varying Marginal Effect of Property" "Rights on FDI at Different Levels of Democracy.")
>                                                 note("Note: Displayed value is the marginal effect of Property Rights when interacted with Democracy from" 
>                                                 "model 2 of Table 2. Darker lines indicate greater levels of Democracy.");

.                                                         graph save Figure_4, replace;
(note: file Figure_4.gph not found)
(file Figure_4.gph saved)

.                         /* Table 2 Model 3 */
>         /* Time- and country-varying slope */
>         /* Interactions of c.cPRdemoc#(id year) c.cefw2legalrights#(id year) not displayed in published table (visualized in Figure 5 instead) */
>         use `temp', clear;

.                 xtmixed ln_FDI_net_inflows c.cPRdemoc#(id year) c.cefw2legalrights#(id year) cxconst cln_GDP2005US cln_GDP_pc2005USD cGDPgrowth cTradePctGDP ckaopen cln_reso
> urce cln_battle
>                 || _all: R.id || _all: R.year , mle ;
note: 2009.year#c.cPRdemoc omitted because of collinearity
note: 1.id#c.cefw2legalrights omitted because of collinearity
note: 2.id#c.cefw2legalrights omitted because of collinearity
note: 5.id#c.cefw2legalrights omitted because of collinearity
note: 6.id#c.cefw2legalrights omitted because of collinearity
note: 9.id#c.cefw2legalrights omitted because of collinearity
note: 12.id#c.cefw2legalrights omitted because of collinearity
note: 14.id#c.cefw2legalrights omitted because of collinearity
note: 25.id#c.cefw2legalrights omitted because of collinearity
note: 26.id#c.cefw2legalrights omitted because of collinearity
note: 27.id#c.cefw2legalrights omitted because of collinearity
note: 28.id#c.cefw2legalrights omitted because of collinearity
note: 30.id#c.cefw2legalrights omitted because of collinearity
note: 33.id#c.cefw2legalrights omitted because of collinearity
note: 34.id#c.cefw2legalrights omitted because of collinearity
note: 35.id#c.cefw2legalrights omitted because of collinearity
note: 36.id#c.cefw2legalrights omitted because of collinearity
note: 37.id#c.cefw2legalrights omitted because of collinearity
note: 38.id#c.cefw2legalrights omitted because of collinearity
note: 39.id#c.cefw2legalrights omitted because of collinearity
note: 41.id#c.cefw2legalrights omitted because of collinearity
note: 42.id#c.cefw2legalrights omitted because of collinearity
note: 43.id#c.cefw2legalrights omitted because of collinearity
note: 45.id#c.cefw2legalrights omitted because of collinearity
note: 46.id#c.cefw2legalrights omitted because of collinearity
note: 47.id#c.cefw2legalrights omitted because of collinearity
note: 50.id#c.cefw2legalrights omitted because of collinearity
note: 51.id#c.cefw2legalrights omitted because of collinearity
note: 52.id#c.cefw2legalrights omitted because of collinearity
note: 54.id#c.cefw2legalrights omitted because of collinearity
note: 55.id#c.cefw2legalrights omitted because of collinearity
note: 56.id#c.cefw2legalrights omitted because of collinearity
note: 57.id#c.cefw2legalrights omitted because of collinearity
note: 58.id#c.cefw2legalrights omitted because of collinearity
note: 59.id#c.cefw2legalrights omitted because of collinearity
note: 60.id#c.cefw2legalrights omitted because of collinearity
note: 68.id#c.cefw2legalrights omitted because of collinearity
note: 72.id#c.cefw2legalrights omitted because of collinearity
note: 78.id#c.cefw2legalrights omitted because of collinearity
note: 81.id#c.cefw2legalrights omitted because of collinearity
note: 84.id#c.cefw2legalrights omitted because of collinearity
note: 85.id#c.cefw2legalrights omitted because of collinearity
note: 86.id#c.cefw2legalrights omitted because of collinearity
note: 90.id#c.cefw2legalrights omitted because of collinearity
note: 91.id#c.cefw2legalrights omitted because of collinearity
note: 92.id#c.cefw2legalrights omitted because of collinearity
note: 95.id#c.cefw2legalrights omitted because of collinearity
note: 101.id#c.cefw2legalrights omitted because of collinearity
note: 104.id#c.cefw2legalrights omitted because of collinearity
note: 105.id#c.cefw2legalrights omitted because of collinearity
note: 107.id#c.cefw2legalrights omitted because of collinearity
note: 109.id#c.cefw2legalrights omitted because of collinearity
note: 110.id#c.cefw2legalrights omitted because of collinearity
note: 111.id#c.cefw2legalrights omitted because of collinearity
note: 113.id#c.cefw2legalrights omitted because of collinearity
note: 121.id#c.cefw2legalrights omitted because of collinearity
note: 124.id#c.cefw2legalrights omitted because of collinearity
note: 125.id#c.cefw2legalrights omitted because of collinearity
note: 126.id#c.cefw2legalrights omitted because of collinearity
note: 2009.year#c.cefw2legalrights omitted because of collinearity

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log likelihood =  377.54321  
Iteration 1:   log likelihood =     377.61  
Iteration 2:   log likelihood =  377.61001  

Computing standard errors:

Mixed-effects ML regression                     Number of obs     =      1,533
Group variable: _all                            Number of groups  =          1

                                                Obs per group:
                                                              min =      1,533
                                                              avg =    1,533.0
                                                              max =      1,533

                                                Wald chi2(234)    =    2408.15
Log likelihood =  377.61001                     Prob > chi2       =     0.0000

-----------------------------------------------------------------------------------------
     ln_FDI_net_inflows |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
          id#c.cPRdemoc |
                     1  |   .1388004   .0114696    12.10   0.000     .1163204    .1612804
                     2  |   .0367547   .0100718     3.65   0.000     .0170144     .056495
                     3  |  -.0229613   .0169157    -1.36   0.175    -.0561155    .0101928
                     4  |  -.1277052   .3908473    -0.33   0.744    -.8937518    .6383413
                     5  |   .0096414   .0236529     0.41   0.684    -.0367174    .0560003
                     6  |    .006936    .035179     0.20   0.844    -.0620136    .0758855
                     7  |  -.0898988   .0393352    -2.29   0.022    -.1669945   -.0128031
                     8  |    .001831   .0200579     0.09   0.927    -.0374818    .0411438
                     9  |   .0480712   .0451619     1.06   0.287    -.0404446    .1365869
                    10  |  -.0230927   .1724249    -0.13   0.893    -.3610392    .3148539
                    11  |  -.0017553   .0198651    -0.09   0.930    -.0406901    .0371795
                    12  |  -.0355176   .0221412    -1.60   0.109    -.0789136    .0078783
                    13  |   .0065568   .0256083     0.26   0.798    -.0436345    .0567482
                    14  |   .0342196   .0202056     1.69   0.090    -.0053827    .0738218
                    15  |    .003718   .0250518     0.15   0.882    -.0453826    .0528186
                    16  |   .0063053    .021387     0.29   0.768    -.0356126    .0482231
                    17  |   -.014755   .0371279    -0.40   0.691    -.0875243    .0580143
                    18  |   .0013743    .014446     0.10   0.924    -.0269394     .029688
                    19  |   .0184946    .094519     0.20   0.845    -.1667593    .2037485
                    20  |  -.0013361   .0140323    -0.10   0.924    -.0288389    .0261666
                    21  |   .0081501   .0160855     0.51   0.612    -.0233769    .0396771
                    22  |  -.0057676   .0219794    -0.26   0.793    -.0488465    .0373113
                    23  |  -.0090998   .0217683    -0.42   0.676    -.0517649    .0335653
                    24  |  -.2356468   .4518718    -0.52   0.602    -1.121299    .6500058
                    25  |   .0919488    .009973     9.22   0.000      .072402    .1114956
                    26  |   .0211198   .0112277     1.88   0.060     -.000886    .0431257
                    27  |   .0812671   .0097836     8.31   0.000     .0620915    .1004426
                    28  |   .1147664   .0176417     6.51   0.000     .0801894    .1493435
                    29  |   .2480947   .0704406     3.52   0.000     .1100336    .3861558
                    30  |   .0109168   .0103569     1.05   0.292    -.0093823    .0312159
                    31  |   .0512639   .0248999     2.06   0.040     .0024611    .1000667
                    32  |  -.0057834   .0241388    -0.24   0.811    -.0530946    .0415279
                    33  |   .0387568   .0101999     3.80   0.000     .0187654    .0587483
                    34  |   .0135001   .0369059     0.37   0.715    -.0588341    .0858344
                    35  |   .0049444   .0098931     0.50   0.617    -.0144457    .0243344
                    36  |   .0171271   .0216209     0.79   0.428     -.025249    .0595032
                    37  |  -.0344257   .0285515    -1.21   0.228    -.0903856    .0215343
                    38  |  -.0968075   .0360004    -2.69   0.007    -.1673671    -.026248
                    39  |   .0220106   .0165179     1.33   0.183    -.0103638    .0543851
                    40  |   .0098924   .1027052     0.10   0.923    -.1914062     .211191
                    41  |   .0054905   .0175159     0.31   0.754    -.0288401     .039821
                    42  |  -.0209394   .0479126    -0.44   0.662    -.1148465    .0729676
                    43  |  -.0267818   .0304568    -0.88   0.379    -.0864761    .0329124
                    44  |   .0079099   .5294987     0.01   0.988    -1.029888    1.045708
                    45  |   -.002249   .0162962    -0.14   0.890     -.034189    .0296911
                    46  |   .0235802   .0416272     0.57   0.571    -.0580076    .1051681
                    47  |  -.0398754   .0696875    -0.57   0.567    -.1764604    .0967097
                    48  |  -.0437255   .1432364    -0.31   0.760    -.3244637    .2370126
                    49  |  -1.470168   .4994389    -2.94   0.003     -2.44905   -.4912854
                    50  |  -.0240042   .0186008    -1.29   0.197     -.060461    .0124526
                    51  |  -.0353015   .0265191    -1.33   0.183    -.0872779     .016675
                    52  |  -.0483843   .0268261    -1.80   0.071    -.1009625    .0041939
                    53  |  -.0494149   .2058436    -0.24   0.810    -.4528609    .3540312
                    54  |  -.0009744   .1137513    -0.01   0.993     -.223923    .2219741
                    55  |   .0123312   .0590278     0.21   0.835    -.1033613    .1280236
                    56  |   .0294962   .0578819     0.51   0.610    -.0839501    .1429426
                    57  |  -.0043812   .0090834    -0.48   0.630    -.0221844     .013422
                    58  |   .0189418    .009748     1.94   0.052    -.0001639    .0380474
                    59  |   .0019288    .009618     0.20   0.841    -.0169222    .0207799
                    60  |  -.0035224   .0092213    -0.38   0.702    -.0215959    .0145511
                    61  |   -.011603   .0220689    -0.53   0.599    -.0548572    .0316512
                    62  |  -.0054993    .025334    -0.22   0.828    -.0551531    .0441546
                    63  |  -.0025132   .0255375    -0.10   0.922    -.0525657    .0475393
                    64  |   .0174981   .0338656     0.52   0.605    -.0488772    .0838735
                    65  |  -.0295021   .1640382    -0.18   0.857    -.3510112    .2920069
                    66  |    .023953   .0320913     0.75   0.455    -.0389449    .0868508
                    67  |  -.0051259   .0864286    -0.06   0.953    -.1745228    .1642711
                    68  |   .0028013   .0786878     0.04   0.972     -.151424    .1570266
                    69  |  -.0069979   .0209597    -0.33   0.738    -.0480781    .0340824
                    70  |   .0040332   .0219253     0.18   0.854    -.0389395     .047006
                    71  |   .0387586   .0782384     0.50   0.620    -.1145858     .192103
                    72  |  -.0257656   .0236257    -1.09   0.275    -.0720711      .02054
                    73  |   .0015643      .0147     0.11   0.915    -.0272472    .0303759
                    74  |  -.0025564   .0658615    -0.04   0.969    -.1316426    .1265298
                    75  |  -.0005669   .0271467    -0.02   0.983    -.0537735    .0526396
                    76  |   .1031082   .1168773     0.88   0.378    -.1259671    .3321835
                    77  |  -.0019553   .0195312    -0.10   0.920    -.0402358    .0363252
                    78  |  -.0213639   .0229333    -0.93   0.352    -.0663123    .0235845
                    79  |   .0006667   .0494387     0.01   0.989    -.0962315    .0975648
                    80  |   .0105189    .025115     0.42   0.675    -.0387057    .0597434
                    81  |    .118688   .1157631     1.03   0.305    -.1082035    .3455795
                    82  |   .0042415   .0232602     0.18   0.855    -.0413476    .0498307
                    83  |  -.0054034   .0455256    -0.12   0.906    -.0946319    .0838252
                    84  |   -.133226    .131367    -1.01   0.311    -.3907006    .1242486
                    85  |  -.1012238   .0760676    -1.33   0.183    -.2503136    .0478661
                    86  |   -.173578   .2994683    -0.58   0.562     -.760525     .413369
                    87  |  -.0171104   .0592281    -0.29   0.773    -.1331954    .0989746
                    88  |  -.0077429   .0404635    -0.19   0.848      -.08705    .0715642
                    89  |   .0020929    .048245     0.04   0.965    -.0924656    .0966514
                    90  |   .0059683   .0157737     0.38   0.705    -.0249475    .0368841
                    91  |    .020849   .0449011     0.46   0.642    -.0671554    .1088535
                    92  |  -.0289703    .039899    -0.73   0.468    -.1071709    .0492304
                    93  |  -.1516588   .0981735    -1.54   0.122    -.3440753    .0407577
                    94  |  -.0000604   .0371285    -0.00   0.999     -.072831    .0727101
                    95  |   .0180582   .0269829     0.67   0.503    -.0348272    .0709437
                    96  |  -.0556169   .0672104    -0.83   0.408    -.1873469    .0761132
                    97  |   .0013294   .0229971     0.06   0.954     -.043744    .0464029
                    98  |   .0099879   .0573915     0.17   0.862    -.1024974    .1224732
                    99  |  -.0051207   .0688609    -0.07   0.941    -.1400856    .1298441
                   100  |   .2536434   .2782162     0.91   0.362    -.2916503    .7989371
                   101  |   -.077143   .0503119    -1.53   0.125    -.1757525    .0214665
                   102  |   .0861019   .0873302     0.99   0.324    -.0850621    .2572659
                   103  |  -.0222579     .04588    -0.49   0.628     -.112181    .0676652
                   104  |   .0059219   .0154957     0.38   0.702    -.0244491    .0362928
                   105  |   .0550755   .0526703     1.05   0.296    -.0481564    .1583075
                   106  |  -.2342158   .6843136    -0.34   0.732    -1.575446    1.107014
                   107  |   -.008202   .0410393    -0.20   0.842    -.0886375    .0722335
                   108  |  -.1419425   .4393006    -0.32   0.747    -1.002956    .7190709
                   109  |   .0040146   .0856083     0.05   0.963    -.1637746    .1718038
                   110  |  -.2006231   .0732741    -2.74   0.006    -.3442378   -.0570085
                   111  |   .0165693   .0209833     0.79   0.430    -.0245572    .0576958
                   112  |  -.0364297   .0336747    -1.08   0.279    -.1024309    .0295715
                   113  |  -.0439862   .0132751    -3.31   0.001    -.0700049   -.0179675
                   114  |   -.144597   .1158646    -1.25   0.212    -.3716874    .0824934
                   115  |   .0052834   .0124472     0.42   0.671    -.0191128    .0296795
                   116  |  -.0006913   .0152658    -0.05   0.964    -.0306117     .029229
                   117  |   .0167861   .1140375     0.15   0.883    -.2067232    .2402954
                   118  |  -.0060883   .0176914    -0.34   0.731    -.0407627    .0285861
                   119  |  -.0289811   .0417081    -0.69   0.487    -.1107274    .0527652
                   120  |   .0893853   .0970614     0.92   0.357    -.1008515    .2796221
                   121  |   .0493679   .0429007     1.15   0.250     -.034716    .1334518
                   122  |   .0064026   .0150272     0.43   0.670    -.0230501    .0358553
                   123  |   .0031226   .0240372     0.13   0.897    -.0439895    .0502347
                   124  |   .0082538   .0097384     0.85   0.397     -.010833    .0273407
                   125  |   .0522323   .0721932     0.72   0.469    -.0892638    .1937284
                   126  |  -.0053148   .0093286    -0.57   0.569    -.0235984    .0129688
                   127  |  -.0128193   .0722583    -0.18   0.859     -.154443    .1288044
                        |
        year#c.cPRdemoc |
                  1970  |  -.0066924   .0140338    -0.48   0.633    -.0341982    .0208134
                  1975  |  -.0118466   .0132638    -0.89   0.372    -.0378431    .0141499
                  1980  |  -.0074302    .010747    -0.69   0.489    -.0284938    .0136335
                  1985  |  -.0054426   .0101504    -0.54   0.592     -.025337    .0144517
                  1990  |  -.0020599   .0102295    -0.20   0.840    -.0221093    .0179895
                  1995  |  -.0070863   .0115566    -0.61   0.540    -.0297368    .0155643
                  2000  |   .0236884    .009961     2.38   0.017     .0041652    .0432115
                  2001  |   .0042566   .0095135     0.45   0.655    -.0143895    .0229026
                  2002  |   .0034805   .0093893     0.37   0.711    -.0149221    .0218831
                  2003  |   -.002114   .0092754    -0.23   0.820    -.0202934    .0160655
                  2004  |  -.0109212   .0094854    -1.15   0.250    -.0295123    .0076699
                  2005  |   .0072969   .0094306     0.77   0.439    -.0111867    .0257805
                  2006  |   .0137737   .0095225     1.45   0.148    -.0048902    .0324375
                  2007  |   .0267723   .0092331     2.90   0.004     .0086757    .0448688
                  2008  |   .0159841     .00952     1.68   0.093    -.0026748     .034643
                  2009  |          0  (omitted)
                        |
  id#c.cefw2legalrights |
                     1  |          0  (omitted)
                     2  |          0  (omitted)
                     3  |   -.012073   .0326121    -0.37   0.711    -.0759916    .0518457
                     4  |   .3031419   .7161636     0.42   0.672    -1.100513    1.706797
                     5  |          0  (omitted)
                     6  |          0  (omitted)
                     7  |   .0113236   .0647014     0.18   0.861    -.1154888     .138136
                     8  |   .0382233   .0385327     0.99   0.321    -.0372995     .113746
                     9  |          0  (omitted)
                    10  |   .0604766   .1545709     0.39   0.696    -.2424768    .3634299
                    11  |   .0067019    .052815     0.13   0.899    -.0968135    .1102174
                    12  |          0  (omitted)
                    13  |   .0712993   .0610195     1.17   0.243    -.0482967    .1908953
                    14  |          0  (omitted)
                    15  |   .0522307   .0300522     1.74   0.082    -.0066705     .111132
                    16  |   .0011425   .0571705     0.02   0.984    -.1109097    .1131946
                    17  |   .0689213   .0693106     0.99   0.320    -.0669251    .2047676
                    18  |   .0729826   .0395528     1.85   0.065    -.0045394    .1505046
                    19  |  -.2916059    .176451    -1.65   0.098    -.6374436    .0542318
                    20  |   .0030981   .0410815     0.08   0.940    -.0774202    .0836163
                    21  |  -.0030919   .0493889    -0.06   0.950    -.0998923    .0937084
                    22  |   .0055678    .058915     0.09   0.925    -.1099036    .1210392
                    23  |   .1051035   .0459584     2.29   0.022     .0150268    .1951803
                    24  |   .8185903   1.296795     0.63   0.528    -1.723081    3.360261
                    25  |          0  (omitted)
                    26  |          0  (omitted)
                    27  |          0  (omitted)
                    28  |          0  (omitted)
                    29  |  -.2030695   .1247851    -1.63   0.104    -.4476438    .0415048
                    30  |          0  (omitted)
                    31  |   .0981325   .0772022     1.27   0.204    -.0531811    .2494461
                    32  |   .0129736   .0698163     0.19   0.853    -.1238638     .149811
                    33  |          0  (omitted)
                    34  |          0  (omitted)
                    35  |          0  (omitted)
                    36  |          0  (omitted)
                    37  |          0  (omitted)
                    38  |          0  (omitted)
                    39  |          0  (omitted)
                    40  |  -.0612572   .1858106    -0.33   0.742    -.4254393    .3029249
                    41  |          0  (omitted)
                    42  |          0  (omitted)
                    43  |          0  (omitted)
                    44  |  -.1450842   1.504986    -0.10   0.923    -3.094802    2.804633
                    45  |          0  (omitted)
                    46  |          0  (omitted)
                    47  |          0  (omitted)
                    48  |   .1173204   .2958341     0.40   0.692    -.4625037    .6971445
                    49  |   1.316884    .398346     3.31   0.001     .5361399    2.097627
                    50  |          0  (omitted)
                    51  |          0  (omitted)
                    52  |          0  (omitted)
                    53  |   .2594174   .2173489     1.19   0.233    -.1665787    .6854135
                    54  |          0  (omitted)
                    55  |          0  (omitted)
                    56  |          0  (omitted)
                    57  |          0  (omitted)
                    58  |          0  (omitted)
                    59  |          0  (omitted)
                    60  |          0  (omitted)
                    61  |   -.067351   .0387023    -1.74   0.082    -.1432061     .008504
                    62  |   -.026412   .0749537    -0.35   0.725    -.1733186    .1204946
                    63  |  -.0040509   .0471393    -0.09   0.932    -.0964421    .0883403
                    64  |  -.0568806   .0602002    -0.94   0.345    -.1748708    .0611097
                    65  |  -.1008162   .3528153    -0.29   0.775    -.7923216    .5906891
                    66  |  -.0678618   .0752685    -0.90   0.367    -.2153855    .0796618
                    67  |   .0427216   .0953562     0.45   0.654     -.144173    .2296163
                    68  |          0  (omitted)
                    69  |  -.0748847   .0455873    -1.64   0.100    -.1642342    .0144648
                    70  |   .0201293   .0508955     0.40   0.692     -.079624    .1198825
                    71  |   .0852302    .182932     0.47   0.641      -.27331    .4437704
                    72  |          0  (omitted)
                    73  |   .0930026     .04006     2.32   0.020     .0144864    .1715188
                    74  |  -.0422361   .1614051    -0.26   0.794    -.3585843    .2741121
                    75  |  -.0617526   .0427896    -1.44   0.149    -.1456187    .0221134
                    76  |   .2320027   .2546634     0.91   0.362    -.2671283    .7311338
                    77  |   .0137487   .0464139     0.30   0.767    -.0772209    .1047183
                    78  |          0  (omitted)
                    79  |   .0084338   .1307538     0.06   0.949     -.247839    .2647066
                    80  |   .0692365   .0525501     1.32   0.188    -.0337597    .1722327
                    81  |          0  (omitted)
                    82  |  -.1010622   .0529664    -1.91   0.056    -.2048745      .00275
                    83  |  -.0189171   .0820874    -0.23   0.818    -.1798055    .1419713
                    84  |          0  (omitted)
                    85  |          0  (omitted)
                    86  |          0  (omitted)
                    87  |  -.0403776   .1666314    -0.24   0.809    -.3669693     .286214
                    88  |   .0169632   .0797586     0.21   0.832    -.1393607    .1732872
                    89  |  -.0359507   .1527101    -0.24   0.814    -.3352571    .2633556
                    90  |          0  (omitted)
                    91  |          0  (omitted)
                    92  |          0  (omitted)
                    93  |   .4414308   .2769087     1.59   0.111    -.1013004     .984162
                    94  |    .006537   .0434837     0.15   0.881    -.0786894    .0917634
                    95  |          0  (omitted)
                    96  |   -.113953   .1484406    -0.77   0.443    -.4048911    .1769851
                    97  |   .0683273   .0478894     1.43   0.154    -.0255343    .1621889
                    98  |  -.0042431   .1268457    -0.03   0.973    -.2528561    .2443699
                    99  |   .0594603   .0991549     0.60   0.549    -.1348797    .2538004
                   100  |   -.581832   .7846131    -0.74   0.458    -2.119645    .9559814
                   101  |          0  (omitted)
                   102  |   .3048384   .2775234     1.10   0.272    -.2390974    .8487742
                   103  |    -.04317   .0998344    -0.43   0.665    -.2388419    .1525019
                   104  |          0  (omitted)
                   105  |          0  (omitted)
                   106  |  -.5690722   1.477296    -0.39   0.700    -3.464518    2.326374
                   107  |          0  (omitted)
                   108  |  -.3190695   .9574852    -0.33   0.739    -2.195706    1.557567
                   109  |          0  (omitted)
                   110  |          0  (omitted)
                   111  |          0  (omitted)
                   112  |  -.0522226   .0651987    -0.80   0.423    -.1800098    .0755645
                   113  |          0  (omitted)
                   114  |   .4365999   .2573125     1.70   0.090    -.0677233    .9409232
                   115  |   .0980368   .0349154     2.81   0.005     .0296038    .1664698
                   116  |   .0856644   .0338855     2.53   0.011     .0192501    .1520787
                   117  |   .0484883   .1164547     0.42   0.677    -.1797587    .2767353
                   118  |  -.0126346   .0540957    -0.23   0.815    -.1186602    .0933909
                   119  |  -.0938761   .0892995    -1.05   0.293       -.2689    .0811478
                   120  |  -.1606635   .0643739    -2.50   0.013     -.286834    -.034493
                   121  |          0  (omitted)
                   122  |   .1132373   .0420704     2.69   0.007     .0307808    .1956937
                   123  |   .1603777   .0565937     2.83   0.005      .049456    .2712993
                   124  |          0  (omitted)
                   125  |          0  (omitted)
                   126  |          0  (omitted)
                   127  |  -.0013649    .138269    -0.01   0.992    -.2723672    .2696375
                        |
year#c.cefw2legalrights |
                  1970  |  -.0808476   .0328899    -2.46   0.014    -.1453106   -.0163846
                  1975  |  -.1193443   .0332598    -3.59   0.000    -.1845323   -.0541562
                  1980  |  -.0689151   .0238684    -2.89   0.004    -.1156963   -.0221339
                  1985  |  -.0830197    .023326    -3.56   0.000    -.1287377   -.0373016
                  1990  |   -.060486   .0232415    -2.60   0.009    -.1060385   -.0149335
                  1995  |  -.0455477   .0272554    -1.67   0.095    -.0989673     .007872
                  2000  |   .0090206   .0229381     0.39   0.694    -.0359372    .0539783
                  2001  |  -.0148543   .0215616    -0.69   0.491    -.0571142    .0274056
                  2002  |  -.0248465   .0211281    -1.18   0.240    -.0662567    .0165637
                  2003  |  -.0314903   .0208705    -1.51   0.131    -.0723957     .009415
                  2004  |  -.0399683   .0212538    -1.88   0.060     -.081625    .0016885
                  2005  |   .0041633   .0210574     0.20   0.843    -.0371084     .045435
                  2006  |   .0322927   .0213334     1.51   0.130      -.00952    .0741054
                  2007  |   .0532001   .0207039     2.57   0.010     .0126213     .093779
                  2008  |   .0207426   .0212879     0.97   0.330    -.0209808    .0624661
                  2009  |          0  (omitted)
                        |
                cxconst |  -.0068685   .0058819    -1.17   0.243    -.0183968    .0046598
          cln_GDP2005US |   .1105532   .0078912    14.01   0.000     .0950866    .1260197
      cln_GDP_pc2005USD |  -.0427025   .0118073    -3.62   0.000    -.0658444   -.0195605
             cGDPgrowth |   .0004759   .0014312     0.33   0.739    -.0023292     .003281
           cTradePctGDP |   .0014426   .0003024     4.77   0.000     .0008499    .0020353
                ckaopen |   .0025197   .0061102     0.41   0.680    -.0094561    .0144954
           cln_resource |    -.01404   .0080738    -1.74   0.082    -.0298643    .0017844
             cln_battle |  -.0042358    .002156    -1.96   0.049    -.0084614   -.0000102
                  _cons |   3.362636    .021397   157.15   0.000     3.320699    3.404574
-----------------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity               |
                    sd(R.id) |   .0462198    .009833      .0304607     .070132
-----------------------------+------------------------------------------------
_all: Identity               |
                  sd(R.year) |   .0563194   .0159461      .0323334    .0980991
-----------------------------+------------------------------------------------
                sd(Residual) |   .1826486   .0036221      .1756856    .1898875
------------------------------------------------------------------------------
LR test vs. linear model: chi2(2) = 25.41                 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

.                         gen id_t=1 if e(sample)==1;
(6,615 missing values generated)

.                 save `temp', replace;
file C:\Users\mdnieman\AppData\Local\Temp\ST_06000001.tmp saved

.                 matrix k_id = e(k);

.                 matrix L_id = e(ll);

.                 svmat k_id;

.                 svmat L_id;

.                 gen AIC_id = 2*k_id1 - 2*L_id1;
(8,147 missing values generated)

.                 sum AIC_id;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      AIC_id |          1     -159.22           .    -159.22    -159.22

.                 /* Figure 5 */
>                 /* Isolate year and country effects */
>                 predict REccode_yr_id REyear_yr_id, reffects level(_all);
(6,615 missing values generated)
(4,981 missing values generated)

.                                 /* generate marginal effects of PR over time*/
>                 gen MEslope_1970_yr = (_b[1970b.year#cPRdemoc])*cxconst + _b[1970b.year#cefw2legalrights]  if year==1970;
(8,027 missing values generated)

.                 gen MEslope_yr=0;

.                 #delimit;
delimiter now ;
.                         forvalues year=1975(5)2000  {;
  2.                                 replace MEslope_yr = (_b[`year'.year#cPRdemoc])*cxconst + _b[`year'.year#cefw2legalrights]  if year==`year' ;
  3.                         };
(201 real changes made, 71 to missing)
(201 real changes made, 74 to missing)
(201 real changes made, 72 to missing)
(201 real changes made, 72 to missing)
(196 real changes made, 49 to missing)
(197 real changes made, 50 to missing)

.                                                 forvalues year=2001/2009  {;
  2.                                 replace MEslope_yr = (_b[`year'.year#cPRdemoc])*cxconst + _b[`year'.year#cefw2legalrights]  if year==`year' ;
  3.                         };
(197 real changes made, 50 to missing)
(197 real changes made, 48 to missing)
(197 real changes made, 49 to missing)
(197 real changes made, 49 to missing)
(197 real changes made, 47 to missing)
(197 real changes made, 43 to missing)
(197 real changes made, 44 to missing)
(195 real changes made, 41 to missing)
(41 real changes made, 41 to missing)

.                         replace MEslope_yr=MEslope_1970_yr if year==1970;
(201 real changes made, 80 to missing)

.                         /* generate marginal effects of PR over space, but ignore the legal right aspect to not over count it when combined */
>                 gen MEslope_1_id = (_b[1b.id#cPRdemoc])*cxconst + _b[1.b.id#cefw2legalrights]  if id==1;
(8,133 missing values generated)

.                         gen MEslope_id=0;

.                         forvalues id=2/127 {;
  2.                         replace MEslope_id = (_b[`id'.id#cPRdemoc])*cxconst + _b[`id'.id#cefw2legalrights]  if id==`id';
  3.                         };
(16 real changes made)
(8 real changes made)
(14 real changes made)
(6 real changes made)
(13 real changes made)
(16 real changes made)
(13 real changes made)
(13 real changes made)
(13 real changes made)
(13 real changes made)
(14 real changes made)
(14 real changes made)
(16 real changes made)
(16 real changes made)
(10 real changes made)
(14 real changes made)
(15 real changes made)
(15 real changes made)
(14 real changes made)
(14 real changes made)
(15 real changes made)
(16 real changes made)
(14 real changes made)
(16 real changes made)
(15 real changes made)
(14 real changes made)
(8 real changes made)
(16 real changes made)
(10 real changes made)
(15 real changes made)
(15 real changes made)
(15 real changes made)
(11 real changes made)
(14 real changes made)
(10 real changes made)
(10 real changes made)
(9 real changes made)
(16 real changes made)
(11 real changes made)
(7 real changes made)
(10 real changes made)
(10 real changes made)
(16 real changes made)
(12 real changes made)
(11 real changes made)
(5 real changes made)
(12 real changes made)
(10 real changes made)
(10 real changes made)
(10 real changes made)
(9 real changes made)
(10 real changes made)
(6 real changes made)
(7 real changes made)
(6 real changes made)
(16 real changes made)
(16 real changes made)
(16 real changes made)
(16 real changes made)
(6 real changes made)
(12 real changes made)
(14 real changes made)
(13 real changes made)
(5 real changes made)
(10 real changes made)
(5 real changes made)
(2 real changes made)
(11 real changes made)
(14 real changes made)
(12 real changes made)
(14 real changes made)
(16 real changes made)
(13 real changes made)
(14 real changes made)
(13 real changes made)
(14 real changes made)
(3 real changes made)
(12 real changes made)
(16 real changes made)
(12 real changes made)
(5 real changes made)
(11 real changes made)
(5 real changes made)
(1 real change made)
(7 real changes made)
(14 real changes made)
(13 real changes made)
(14 real changes made)
(16 real changes made)
(11 real changes made)
(5 real changes made)
(13 real changes made)
(13 real changes made)
(13 real changes made)
(16 real changes made)
(15 real changes made)
(14 real changes made)
(13 real changes made)
(15 real changes made)
(14 real changes made)
(12 real changes made)
(14 real changes made)
(16 real changes made)
(9 real changes made)
(12 real changes made)
(12 real changes made)
(12 real changes made)
(5 real changes made)
(13 real changes made)
(6 real changes made)
(14 real changes made)
(14 real changes made)
(15 real changes made)
(15 real changes made)
(14 real changes made)
(14 real changes made)
(10 real changes made)
(15 real changes made)
(16 real changes made)
(8 real changes made)
(16 real changes made)
(13 real changes made)
(15 real changes made)
(13 real changes made)
(14 real changes made)
(10 real changes made)

.                         replace MEslope_id=MEslope_1_id if id==1;
(15 real changes made)

.                 gen MEslope_yr_id = MEslope_yr + MEslope_id + REccode_yr_id + REyear_yr_id;
(6,615 missing values generated)

.                 save `temp_efw', replace;
(note: file C:\Users\mdnieman\AppData\Local\Temp\ST_06000002.tmp not found)
file C:\Users\mdnieman\AppData\Local\Temp\ST_06000002.tmp saved

.                 keep if (MEslope_yr_id<.9 & MEslope_yr_id!=.);
(6,619 observations deleted)

.                 keep if (MEslope_yr_id>(-.9) & MEslope_yr_id!=.);
(1 observation deleted)

.                         /* Plot slope for different regions */
>                         twoway connected MEslope_yr_id year if ccode>1 &ccode<200 & year<2010 & id_t==1, connect(L) scheme(s1mono)
>                                 ytitle("") xtitle("") legend(off) yline(0, lcolor(gs8))
>                                 t2("Americas") ylabel(-0.5 "-0.5" 0 "0" 0.5 "0.5", noticks) ytick(0.5(.5).5);

.                                 graph save Figure_5a, replace;
(note: file Figure_5a.gph not found)
(file Figure_5a.gph saved)

.                                                         twoway connected MEslope_yr_id year if ccode>199 &ccode<400 & year<2010 & id_t==1 , connect(L) scheme(s1mono)
>                                 ytitle("") xtitle("") legend(off) yline(0, lcolor(gs8))
>                                 t2("Europe") ylabel(-0.5 "-0.5" 0 "0" 0.5 "0.5", noticks) ytick(0.5(.5).5);

.                                 graph save Figure_5b, replace;
(note: file Figure_5b.gph not found)
(file Figure_5b.gph saved)

.                                                                         twoway connected MEslope_yr_id year if ccode>399 &ccode<600 & year<2010 & id_t==1, connect(L) scheme(
> s1mono)
>                                 ytitle("") xtitle("") legend(off) yline(0, lcolor(gs8))
>                                 t2("Africa") ylabel(-0.5 "-0.5" 0 "0" 0.5 "0.5", noticks) ytick(0.5(.5).5);

.                                 graph save Figure_5c, replace;
(note: file Figure_5c.gph not found)
(file Figure_5c.gph saved)

.                                                         twoway connected MEslope_yr_id year if ccode>599 &ccode<700 & year<2010 & id_t==1 , connect(L) scheme(s1mono)
>                                 ytitle("") xtitle("") legend(off) yline(0, lcolor(gs8))
>                                 t2("Middle East") ylabel(-0.5 "-0.5" 0 "0" 0.5 "0.5" , noticks) ytick(0.5(.5).5);

.                                 graph save Figure_5d, replace;
(note: file Figure_5d.gph not found)
(file Figure_5d.gph saved)

.                                                         twoway connected MEslope_yr_id year if ccode>699 &ccode<800 & year<2010 & id_t==1, connect(L) scheme(s1mono)
>                                 ytitle("") xtitle("") legend(off) yline(0, lcolor(gs8))
>                                 t2("Central & North Asia") ylabel(-0.5 "-0.5" 0 "0" 0.5 "0.5", noticks) ytick(0.5(.5).5);

.                                 graph save Figure_5e, replace;
(note: file Figure_5e.gph not found)
(file Figure_5e.gph saved)

.                         #delimit;
delimiter now ;
.                                 twoway connected MEslope_yr_id year if ccode>799 &ccode<999 & year<2010 & id_t==1, connect(L) scheme(s1mono)
>                                 ytitle("") xtitle("") legend(off) yline(0, lcolor(gs8))
>                                 t2("Southeast Asia & Oceania") ylabel(-0.5 "-0.5" 0 "0" 0.5 "0.5", noticks) ytick(0.5(.5).5);

.                                 graph save Figure_5f, replace;
(note: file Figure_5f.gph not found)
(file Figure_5f.gph saved)

.                                         graph combine Figure_5a.gph Figure_5b.gph Figure_5c.gph Figure_5d.gph Figure_5e.gph Figure_5f.gph,
>                                 sch(s1mono) 
>                                 b1title("Year")  xcommon
>                                 l1title("Marginal Effect of Property Rights on FDI") 
>                                 title("Figure 5. Time-varying and Country-varying" "Marginal Effect of Property Rights on FDI.")
>                                 note("Note: Displayed value is the marginal effect of Property Rights when interacted with Democracy from" 
>                                 "model 3 of Table 2. Table does not display marginal effect for Russia 2007-2009 (1.714, 1.658, 1.603);"
>                                 "Turkey 1980 (-1.506), or Uruguay 1980 (0.990), to maximize overall visualization.");

.                                 graph save Figure_5, replace;
(note: file Figure_5.gph not found)
(file Figure_5.gph saved)

.                                 /* Figure 6 */
>                 /* Present evidence that the number of countries with a positive PR marg effect has increased */
>                 use `temp_efw', clear;

.                 egen posME_yr_id = count(MEslope_yr_id) if MEslope_yr_id>0 & MEslope_yr_id!=., by(year);
(7308 missing values generated)

.                 egen N_ccode = count(ccode) if MEslope_yr_id!=., by(year);
(6615 missing values generated)

.                 gen pct_MEslope_pos = posME_yr_id/ N_ccode;
(7,308 missing values generated)

.                 #delimit;
delimiter now ;
.                 twoway line pct_MEslope_pos year, sort sch(s1mono) ytitle("Proportion of Countries") 
>                                 xtitle("Year") xlabel(1970 "1970" 1980 "1980" 1990 "1990" 2000 "2000" 2010 "2010" , noticks) xtick(1970(10)2010)
>                                 title("Figure 6. Proportion of Countries with a Positive" "Property Rights Regime Coefficient.")
>                                 note("Note: Proportion based on marginal effect of Property Rights when interacted with Democracy from" 
>                                 "sample in model 3 of Table 2.");

.                                 graph save Figure_6, replace;
(note: file Figure_6.gph not found)
(file Figure_6.gph saved)

.                                                                         log close;
      name:  <unnamed>
       log:  C:\Users\mdnieman\Desktop\PSRM replication\PSRM_PRR.log
  log type:  text
 closed on:  12 Dec 2017, 14:42:09
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
